﻿<%@page import="weaver.general.Util"%>
<%@page import="java.util.*"%>
<%@page import="net.sf.json.JSONArray"%>
<%@ page import="java.io.PrintWriter" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %> 
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<%
	int requestid = Util.getIntValue(request.getParameter("requestid"),0);//请求id
	int workflowid = Util.getIntValue(request.getParameter("workflowid"));//流程id
	int formid = Util.getIntValue(request.getParameter("formid"));//表单id
	int isbill = Util.getIntValue(request.getParameter("isbill"));//表单类型，1单据，0表单
	int nodeid = Util.getIntValue(request.getParameter("nodeid"));//流程的节点id
	int scoreid = Util.getIntValue(request.getParameter("scoreid"));//scoreid
	int type = Util.getIntValue(request.getParameter("type"));//0：查看；1：创建；2：编辑；3：监控
	int billid = Util.getIntValue(request.getParameter("billid"),0);//数据id
%>

<%
	int qhmcId = Util.getIntValue(request.getParameter("name"),0);
	Map<String,String> map = new LinkedHashMap<String,String>();
	RecordSet record = new RecordSet();
	RecordSet record1 = new RecordSet();
	String sql = "";
	if(qhmcId != 0){
		sql = "SELECT * FROM Prj_TaskProcess WHERE level_n=1 AND prjid="+qhmcId;
		record.execute(sql);
		while(record.next()){
			String subject = Util.null2String(record.getString("subject"));		//项目名称
			String beginDate = Util.null2String(record.getString("begindate"));	//开始日期
			String endDate = Util.null2String(record.getString("endDate"));		//结束日期
			String hrmid = Util.null2String(record.getString("hrmid"));			//阶段负责人id
			String hrmname = "";
			if("1".equals(hrmid)){
				record1.execute("SELECT lastname From hrmresourcemanager where id='"+hrmid+"'");
				record1.next();
				hrmname = Util.null2String(record1.getString("lastname"));
			}else{
				record1.execute("SELECT lastname From hrmresource where id='"+hrmid+"'");
				record1.next();
				hrmname = Util.null2String(record1.getString("lastname"));
			}
			if("企画审批".equals(subject)){
				map.put("qhksrq", beginDate);
				map.put("qhjsrq", endDate);
				map.put("qhfzr", hrmname);
				//审批人
				map.put("qhfzrid",hrmid);
			}else if("合同审批".equals(subject)){
				map.put("htksrq", beginDate);
				map.put("htjsrq", endDate);
				map.put("htfzr", hrmname);
				//审批人
				map.put("htfzrid",hrmid);
			}else if("预验收".equals(subject)){
				map.put("yysksrq", beginDate);
				map.put("yysjsrq", endDate);
				map.put("yysfzr", hrmname);
				//审批人
				map.put("yysfzrid",hrmid);
			}else if("验收".equals(subject)){
				map.put("ysksrq", beginDate);
				map.put("ysjsrq", endDate);
				map.put("ysfzr", hrmname);
				//审批人
				map.put("ysfzrid",hrmid);
			}else if("结案".equals(subject)){
				map.put("jaksrq", beginDate);
				map.put("jajsrq", endDate);
				map.put("jafzr", hrmname);
				//审批人
				map.put("jafzrid",hrmid);
			}
		}
	}
	JSONArray json = JSONArray.fromObject(map);
	String result = json.toString();
	PrintWriter pw = response.getWriter();
	pw.write(result);
	pw.flush();
	pw.close();
%>




